<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>服务器购买及宝塔部署环境说明 | 小李博客</title><meta name="keywords" content="企业常用技术"><meta name="author" content="小李博客"><meta name="copyright" content="小李博客"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="服务器购买 作为一个程序员，必须要发布自己的网站和项目！ 自己的远程仓库、远程数据库、远程tomcat….. 搭建在服务器上 练习，Linux进行任意的环境部署操作！ Window下开发，你不熟悉Linux  轻量级服务器 如果是学生或者24以下的小伙伴，可以购买学生机，100多元一年 学生机链接：https:&#x2F;&#x2F;www.aliyun.com&#x2F;activity&#x2F;promotion&#x2F;campus20">
<meta property="og:type" content="article">
<meta property="og:title" content="服务器购买及宝塔部署环境说明">
<meta property="og:url" content="http://xiaoliblog.cn/page/server.html">
<meta property="og:site_name" content="小李博客">
<meta property="og:description" content="服务器购买 作为一个程序员，必须要发布自己的网站和项目！ 自己的远程仓库、远程数据库、远程tomcat….. 搭建在服务器上 练习，Linux进行任意的环境部署操作！ Window下开发，你不熟悉Linux  轻量级服务器 如果是学生或者24以下的小伙伴，可以购买学生机，100多元一年 学生机链接：https:&#x2F;&#x2F;www.aliyun.com&#x2F;activity&#x2F;promotion&#x2F;campus20">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/xiaoliblog/image@b8cd50b76d641acb7d91939cf488d974ac872cde/2021/03/05/b9345f8f1e57bd17d1607475a3d62640.png">
<meta property="article:published_time" content="2021-04-04T16:00:00.000Z">
<meta property="article:modified_time" content="2021-04-27T13:05:51.826Z">
<meta property="article:author" content="小李博客">
<meta property="article:tag" content="企业常用技术">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/xiaoliblog/image@b8cd50b76d641acb7d91939cf488d974ac872cde/2021/03/05/b9345f8f1e57bd17d1607475a3d62640.png"><link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/xiaoliblog/image@6b5e7ef72be1c8973d94e5a9c49accbf775ad820/2021/02/01/c485da031fe0e464d04eaba8a66c4a8f.png"><link rel="canonical" href="http://xiaoliblog.cn/page/server"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.js" defer></script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: {"appId":"RTG4CPNBLJ","apiKey":"f1745bdad68ceec57653b78244fe332c","indexName":"MyBlogIndex","hits":{"per_page":6},"languages":{"input_placeholder":"搜索文章","hits_empty":"找不到您查询的内容：${query}","hits_stats":"找到 ${hits} 条结果，用时 ${time} 毫秒"}},
  localSearch: undefined,
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":200},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":100,"languages":{"author":"作者: 小李博客","link":"链接: ","source":"来源: 小李博客","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'mediumZoom',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"top-center"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-04-27 21:05:51'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const fontSizeVal = saveToLocal.get('global-font-size')
    if (fontSizeVal !== undefined) {
      document.documentElement.style.setProperty('--global-font-size', fontSizeVal + 'px')
    }
    })(window)</script><link rel="stylesheet" href="/css/MyStyle/MyStyle.css" media="defer" onload="this.media='all'"/><link rel="stylesheet" href="/css/MyStyle/tagStyle.css" media="defer" onload="this.media='all'"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zykjofficial/zykjresource@master/css/font-awesome-animation.min.css" media="defer" onload="this.media='all'"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sviptzk/StaticFile_HEXO@latest/butterfly/css/font-awesome-animation.min.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sviptzk/StaticFile_HEXO@latest/butterfly/css/plugins.min.css" media="defer" onload="this.media='all'"><meta name="generator" content="Hexo 5.2.0"><link rel="alternate" href="/atom.xml" title="小李博客" type="application/atom+xml">
</head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@6b5e7ef72be1c8973d94e5a9c49accbf775ad820/2021/02/01/c485da031fe0e464d04eaba8a66c4a8f.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">210</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">38</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">56</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/box/"><i class="fa-fw fa fa-briefcase"></i><span> 工具箱</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-book"></i><span> 找文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fa fa-address-card"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="not-top-img" id="page-header"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">小李博客</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/box/"><i class="fa-fw fa fa-briefcase"></i><span> 工具箱</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-book"></i><span> 找文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fa fa-address-card"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav></header><main class="layout" id="content-inner"><div id="post"><div id="post-info"><h1 class="post-title">服务器购买及宝塔部署环境说明</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-04-04T16:00:00.000Z" title="发表于 2021-04-05 00:00:00">2021-04-05</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-04-27T13:05:51.826Z" title="更新于 2021-04-27 21:05:51">2021-04-27</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E4%BC%81%E4%B8%9A%E5%B8%B8%E7%94%A8%E6%8A%80%E6%9C%AF/">企业常用技术</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E4%BC%81%E4%B8%9A%E5%B8%B8%E7%94%A8%E6%8A%80%E6%9C%AF/%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%B4%AD%E4%B9%B0%E5%8F%8A%E5%AE%9D%E5%A1%94%E9%83%A8%E7%BD%B2%E7%8E%AF%E5%A2%83%E8%AF%B4%E6%98%8E/">服务器购买及宝塔部署环境说明</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">1.9k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>6分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="服务器购买及宝塔部署环境说明"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div><article class="post-content" id="article-container"><h1 id="服务器购买"><a href="#服务器购买" class="headerlink" title="服务器购买"></a>服务器购买</h1><ul>
<li>作为一个程序员，必须要发布自己的网站和项目！</li>
<li>自己的远程仓库、远程数据库、远程tomcat….. 搭建在服务器上</li>
<li>练习，Linux进行任意的环境部署操作！ Window下开发，你不熟悉Linux</li>
</ul>
<h2 id="轻量级服务器"><a href="#轻量级服务器" class="headerlink" title="轻量级服务器"></a>轻量级服务器</h2><ul>
<li>如果是学生或者24以下的小伙伴，可以购买学生机，100多元一年</li>
<li>学生机链接：<a target="_blank" rel="noopener" href="https://www.aliyun.com/activity/promotion/campus2018">https://www.aliyun.com/activity/promotion/campus2018</a></li>
<li>优惠活动：<a target="_blank" rel="noopener" href="https://www.aliyun.com/sale-season/2020/procurement-new-members?userCode=0phtycgr">https://www.aliyun.com/sale-season/2020/procurement-new-members?userCode=0phtycgr</a></li>
<li>服务器购买流程参考：<a target="_blank" rel="noopener" href="https://www.kubk.net/800.html">https://www.kubk.net/800.html</a></li>
<li>轻量级服务器配置参考：<a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_43553694/article/details/104105256">https://blog.csdn.net/weixin_43553694/article/details/104105256</a></li>
</ul>
<div class="note warning simple"><p>香港服务器可以避免备案，但是尽量不要自己挂VPN，会被封！</p>
</div>

<ul>
<li>认证好学生后，可以购买轻量级1核2G</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@620f970477ca8ea17abefb195bf97414cfce52ed/2021/04/10/e61529c9062fbafae9cb55790e16780b.png"></p>
<ul>
<li>系统镜像就是纯净版系统 ，应用镜像就是安装了部分软件的系统。个人建议选择系统镜像，再去安装所需的软件就行，比如宝塔面板一键安装部署</li>
</ul>
<img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@0e7590893b7d25c0aea73889e168df0f22f65fa7/2021/04/10/514509a0070a1d7081fc56e1d7ff8946.png" width="100%">

<ul>
<li>进入轻量应用服务器控制台，可以看到自己的服务器</li>
</ul>
<img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@25c58839e4d970d894c17e44873fb848fa3eed46/2021/04/10/9de09159406c61943dfb78ad298845ba.png" width="50%">

<h1 id="设置可视化面板"><a href="#设置可视化面板" class="headerlink" title="设置可视化面板"></a>设置可视化面板</h1><ul>
<li>进入服务器，我们使用的可视化面板为宝塔（<code>BT-Panel</code>），使用之前要先确定自己的系统是<code>CentOS</code></li>
<li>如果之前没有设置，可以在左侧边栏：【服务器运维】-【重制系统】下的【应用镜像】和【系统镜像】设置</li>
<li>应用镜像设置为<code>BT-Panel</code>，系统镜像设置为<code>CentOS</code></li>
<li>设置之后系统会被重置，确保重置不会影响自己服务器中已部署的程序的运行，如果是新服务器则不需担心此问题</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@d5fbf53d3cecf644f6c044c8c896f033101967a5/2021/04/10/49cb79874b66f1fc8a6add89955fddd3.png"></p>
<h2 id="配置宝塔面板"><a href="#配置宝塔面板" class="headerlink" title="配置宝塔面板"></a>配置宝塔面板</h2><ul>
<li>进入侧边栏：【应用管理】-【应用详情】，这里会有如何配置宝塔界面的使用方法</li>
</ul>
<img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@7f5a2a0e054618f73e5f806756fb5852afc3cf3b/2021/04/10/1c485313f011189a32ad5e31e5bd1248.png" width="50%" height="50%">

<h2 id="获取面板初始密码"><a href="#获取面板初始密码" class="headerlink" title="获取面板初始密码"></a>获取面板初始密码</h2><ul>
<li>按照顺序，先点击<strong>1.复制密码查询指令</strong>，会将查询密码的指令复制到剪切板</li>
<li>再点击<strong>2</strong>，会弹出一个终端，粘贴上剪切板的内容，敲回车</li>
<li>下一行出现的就是你的宝塔面板默认密码，这个密码可以用于忘记账号密码等等</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@6d5ceac159365fcb9f51920d602d80601b1b40e0/2021/04/10/30eef42d8c12ec56d68ca8f90a22782c.png"></p>
<h2 id="忘记宝塔密码的解决方案"><a href="#忘记宝塔密码的解决方案" class="headerlink" title="忘记宝塔密码的解决方案"></a>忘记宝塔密码的解决方案</h2><ul>
<li>使用超级管理员权限，在远程连接中输入以下命令重置密码</li>
<li>重置密码之后就可以使用面板的初始密码和用户名登陆</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cd /www/server/panel &amp;&amp; python tools.py panel testpasswd</span><br></pre></td></tr></table></figure>

<ul>
<li>如果提示多次登录失败，暂时禁止登录 请输入以下命令 清除登录限制</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rm -f /www/server/panel/data/*.login</span><br></pre></td></tr></table></figure>

<h2 id="登录面板"><a href="#登录面板" class="headerlink" title="登录面板"></a>登录面板</h2><ul>
<li>在安全-防火墙中将<code>8888</code>端口开放</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@8ad911c9b2caf5153848311ee55e57dc059f8daa/2021/04/10/9b0ca579f71aea6569f3c108ec9cc0f3.png"></p>
<ul>
<li><p>在浏览器中新开页面，在网址处输入<code>自己服务器的IP:8888</code>，比如自己服务器的IP是<code>127.0.0.1</code>，就输入<code>127.0.0.1:8888</code>，就会进入宝塔的登陆界面（服务器IP可以在配置方法里看到）</p>
</li>
<li><p>默认用户名为<code>admin</code>，密码是刚才我们获取到的</p>
</li>
<li><p>进入宝塔面板的面板设置，修改自己的用户名和密码</p>
</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@03ea1decca01011b93585743c02bd18eb2638d0d/2021/04/10/8070874de7b7936b162381d665389467.png"></p>
<ul>
<li>可以看到宝塔面板上的【文件】，这就是远程服务器上的文件</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@6de4e6f39e17edaafdcbc78531d92a153f03ea28/2021/04/10/0d385b16e43c408aa20a825064592e4e.png"></p>
<ul>
<li>接下来介绍另一种远程连接方式，通过Shell和Xftp进行远程服务器访问</li>
</ul>
<h1 id="XShell远程连接"><a href="#XShell远程连接" class="headerlink" title="XShell远程连接"></a>XShell远程连接</h1><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@8210bdc0492a490a5ee49407c74e48c2d3a33eb8/2021/04/10/9738cf6b0dc337fe038fea25e5478d5b.png" width="60%">

<ul>
<li>为什么要远程连接？<ul>
<li>公司服务器不是个人电脑更不是虚拟机，其有独立的机房存放</li>
<li>补充：有的机房 “藏” 在山里，一方面可以防止人为干扰，另一方面气温较低有助于服务器冷却</li>
</ul>
</li>
<li>如何远程连接？用什么软件？<ul>
<li><code>Xshell</code>：实现远程连接、命令行操控服务器</li>
<li><code>Xftp</code>：帮助服务器实现文件的上传和下载</li>
</ul>
</li>
<li>官网下载地址：<a target="_blank" rel="noopener" href="https://www.netsarang.com/zh/all-downloads/">https://www.netsarang.com/zh/all-downloads/</a></li>
<li>选择右边家庭和学校用户的免费许可证下载</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@00ba584155bf2107021244c55316b888448e08e5/2021/04/10/7eef36384896fb03e15f14589c5e9f16.png"><br><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@9380ab8e52a1deef0b10bb4bf54597644578d762/2021/04/10/64d93c851a0bc4d6882bf526c16b7bc1.png"></p>
<ul>
<li>然后会通过邮件发送下载链接给你</li>
</ul>
<h2 id="XShell"><a href="#XShell" class="headerlink" title="XShell"></a>XShell</h2><ul>
<li>下载好XShell软件后，直接打开，点击【文件】【新建】，填入<strong>服务器IP</strong>和<strong>服务器端口号</strong>进行连接，IP和端口号在阿里云控制台可以找到，<strong>22端口要在安全组打开</strong></li>
<li>在阿里云控制台设置如下</li>
</ul>
<img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@410018eb9d83036fbd6d1bc43b5b6ccef3771b02/2021/04/10/961bd30d600a968e757ec18582a39b44.png" width="80%">


<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@8d5cd646f3ec542924ce930f0c1c0db6c453de7f/2021/04/10/b08d1474cc01ab99977f20cf692283c3.png"></p>
<ul>
<li>再次打开软件需要登录，用户名<code>root</code>，密码为在阿里云设置的密码</li>
<li>连接成功如下所示</li>
</ul>
<img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@9d4c0ae9524b6c16698b03b4013a005c5d6f301f/2021/04/10/1d563dddb2ae44ba68661c4161ab6219.png" width="70%">

<ul>
<li><code>Ctrl+滚轮</code>可以缩放字体，你可以通过Liunx命令操作服务器了</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@689d35dfaed371d8f6c6ebbe168ed821650336a2/2021/04/10/982a241e6bd529e1ce84ef7624fbbc91.png"></p>
<h2 id="Xftp"><a href="#Xftp" class="headerlink" title="Xftp"></a>Xftp</h2><ul>
<li>上传文件使用<code>Xftp</code>即可，直接在XShell可以看到，前提是已经下载了Xftp</li>
</ul>
<img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@8787826e637241a7dea38c96f942925479f47c80/2021/04/10/4ec065b42b72112a5026e5a7c85bbc8c.png" width="60%">

<ul>
<li>打开Xftp，可以看到划分为两个窗口，分别代表本地和远程服务器，文件交互拖到就可以</li>
</ul>
<img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@e2f477e1ad6fe63f25eddea90e853a61f1bee467/2021/04/10/0f3c12d1f1a4d50a92e89623fea57819.png" width="70%">


<h2 id="安装宝塔"><a href="#安装宝塔" class="headerlink" title="安装宝塔"></a>安装宝塔</h2><ul>
<li>也可以通过XShell安装宝塔界面</li>
<li>下载安装地址：<a target="_blank" rel="noopener" href="https://www.bt.cn/bbs/thread-19376-1-1.html">https://www.bt.cn/bbs/thread-19376-1-1.html</a></li>
<li>在网址中找一个命令用于下载宝塔</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install -y wget &amp;&amp; wget -O install.sh http://download.bt.cn/install/install_6.0.sh &amp;&amp; sh install.sh</span><br></pre></td></tr></table></figure>

<ul>
<li>下载完毕之后，就可以得到一个地址：宝塔的管理面板！</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@f3bbf171481886fc349b4c1d33cfed05ad192a27/2021/04/10/2c40993b56afe0ceddde405816b4d0e9.png"></p>
<h1 id="Tomcat部署Java项目"><a href="#Tomcat部署Java项目" class="headerlink" title="Tomcat部署Java项目"></a>Tomcat部署Java项目</h1><h2 id="远程连接超级管理员权限"><a href="#远程连接超级管理员权限" class="headerlink" title="远程连接超级管理员权限"></a>远程连接超级管理员权限</h2><ul>
<li>如下图进入远程连接，在远程连接中输入下行命令，获取超级管理员权限</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo su root</span><br></pre></td></tr></table></figure>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@fd7bada22961aa33d2b3760f39338ae8f3bca44f/2021/04/10/c348519479a4aafd8d17955794bb6995.png"></p>
<h2 id="安装JDK"><a href="#安装JDK" class="headerlink" title="安装JDK"></a>安装JDK</h2><ul>
<li>下载JDK的压缩包，在本机上将jdk解压成文件夹</li>
<li>在宝塔面板中，进入文件，找到根目录<code>/www/server</code>，将jdk安装包上传到这个目录下</li>
<li>配置环境变量，将<code>/etc/profile</code>文件，编辑打开，在最后一行加入如下环境变量</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">&#x2F;&#x2F;下面的路径要根据自己jdk的位置，改成自己服务器上的路径</span><br><span class="line">JAVA_HOME&#x3D;&#x2F;usr&#x2F;local&#x2F;java&#x2F;jdk8</span><br><span class="line">PATH&#x3D;&#x2F;usr&#x2F;java&#x2F;jdk8&#x2F;bin:$PATH</span><br><span class="line">CLASSPATH&#x3D;.:&#x2F;usr&#x2F;local&#x2F;java&#x2F;jdk8&#x2F;lib&#x2F;dt.jar:&#x2F;usr&#x2F;java&#x2F;jdk8&#x2F;lib&#x2F;tools.jar</span><br><span class="line">export JAVA_HOME PATH CLASSPATH CATALINA_HOME</span><br></pre></td></tr></table></figure>

<ul>
<li>在远程连接中输入如下命令，启用文件</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">source /etc/profile</span><br></pre></td></tr></table></figure>

<ul>
<li>之后在远程连接中输入<code>javac</code>来测试是否配置成功</li>
</ul>
<h2 id="环境安装"><a href="#环境安装" class="headerlink" title="环境安装"></a>环境安装</h2><ul>
<li>进入面板选择软件管理，安装<code>Nginx</code> 、<code>Apache</code>、<code>MySQL</code>、<code>Tomcat</code>（安装合适的版本即可)</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@2323bdd55e1a0a4aa3119dee4940ac5358caf83d/2021/04/10/b64a5928ee687a76b3348588d653572b.png"></p>
<div class="note success simple"><p>默认的安装目录在根目录<code>/www/server</code>下</p>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@7f366ef4efd428fdf2bec33a4b71f61e214bd04d/2021/04/10/6e735a46f4fe5680ae648d76d1e3447f.png"></p>
<h2 id="配置站点"><a href="#配置站点" class="headerlink" title="配置站点"></a>配置站点</h2><ul>
<li>如果已经绑定域名，将域名添加到站点中</li>
<li>如果没有安装Ngnix，是不能添加站点的</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@bdb4ee68477a867d2686f66ea1c403bd089ecf06/2021/04/10/449ff14679e52c53214063ad8183ca01.png"></p>
<ul>
<li>这时在浏览器中输入域名就可以看到站点创建成功的提示</li>
</ul>
<h2 id="放行端口"><a href="#放行端口" class="headerlink" title="放行端口"></a>放行端口</h2><ul>
<li>在安全中，将Tomcat将要使用的8080端口放行</li>
<li>由于数据库使用的是Mysql，默认端口3306，所以我们将3306端口也放行</li>
<li>如果不放行端口，就会出现端口无法访问的情况</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@7482c0ed27ea120c02d9a20fe9ebbdc919d8fc42/2021/04/10/8825d01ef9772b5447225522460b7130.png"></p>
<ul>
<li>只在这里放行是不可以的，还要回到阿里云服务器界面，在阿里云中也放行8080和3306</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@098e3d68fc189b5f3d256216aa9825d714da9882/2021/04/10/1e560aca886ff5c1804d24b5d15f85ce.png"></p>
<h2 id="部署项目"><a href="#部署项目" class="headerlink" title="部署项目"></a>部署项目</h2><ul>
<li>在宝塔页面的文件管理中，进入tomcat的<code>webapp</code>文件夹，将本地打包好的war包上传</li>
<li>只需要上传就可以，tomcat运行时会自动解压出文件夹</li>
<li>如果将war包删除，解压出的文件夹也会自动删除</li>
</ul>
<img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@20eac8d89f98b4d852fe818d11becc11a83fb300/2021/04/10/f4ff0b65a33efd46673b72cecbcbbbbb.png" width="80%">

<ul>
<li>在宝塔文件管理的上方打开宝塔终端，cd进入tomcat的bin目录，图片中的目录是默认安装目录之后使用<code>./catalina.sh start</code>启动tomcat，刚刚上传的war包就会自动解压</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@194e94454e60c85cadf0ea552fa47acdcb82af61/2021/04/10/25a7098f9c15c1b5d5f89f6b494b193b.png"></p>
<ul>
<li>部署成功后，在浏览器输入<code>域名:8080</code>就可以访问tomcat首页，按照自己项目访问路径就可以访问自己的项目</li>
</ul>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">小李博客</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://xiaoliblog.cn">https://xiaoliblog.cn</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://xiaoliblog.cn" target="_blank">小李博客</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E4%BC%81%E4%B8%9A%E5%B8%B8%E7%94%A8%E6%8A%80%E6%9C%AF/">企业常用技术</a></div><div class="post_share"><div class="social-share" data-image="https://cdn.jsdelivr.net/gh/xiaoliblog/image@b8cd50b76d641acb7d91939cf488d974ac872cde/2021/03/05/b9345f8f1e57bd17d1607475a3d62640.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button button--animated"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/img/wechat.png" target="_blank"><img class="post-qr-code-img" src="/img/wechat.png" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/img/alipay.png" target="_blank"><img class="post-qr-code-img" src="/img/alipay.png" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/page/Webpack01.html"><img class="prev-cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@08811e0ec956319411884142afa451ddfd6c7d94/2021/04/19/a243305c9fa40964cfdb10145b451e98.png" onerror="onerror=null;src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Webpack🌞Webpack安装及使用</div></div></a></div><div class="next-post pull-right"><a href="/page/SpringMVC09.html"><img class="next-cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@17ff12fb4641cb46769b83f7831a0b8c46ee5487/2021/04/02/d1e5330701efd80a86ea6847d715b981.png" onerror="onerror=null;src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">SpringMVC🍃SSM整合案例</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/page/Ngrok.html" title="Ngrok内网穿透技术"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@325711b4582f41dc46b8fd9042f1815f684f6a3e/2021/03/21/d8f7dea318fe22b1b6efca6de912d9c4.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-21</div><div class="title">Ngrok内网穿透技术</div></div></a></div><div><a href="/page/EasyEscel.html" title="POI及EasyExcel技术"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@9e9580790103438844006d318376ce0705ea3391/2021/03/21/d1526753cb5cf7b4ca23e2441600c3dc.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-21</div><div class="title">POI及EasyExcel技术</div></div></a></div><div><a href="/page/Alipay.html" title="支付宝支付对接"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@61a9b6a6e09e4bda38bb08e3104b717885beaee5/2021/04/29/c3fa51f9cf14e90d9e5a7aa8814dd041.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-04-28</div><div class="title">支付宝支付对接</div></div></a></div><div><a href="/page/message.html" title="第三方短信接入"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@3df69ce79a43aead58a4cff7b7fa87893cc5b560/2021/03/21/225a42983e955972e4038a3f1e4bf592.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-21</div><div class="title">第三方短信接入</div></div></a></div><div><a href="/page/WeChatpay.html" title="微信支付对接"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@f2f670b92ea149650ffa7834354fc90284f2f44a/2021/04/29/5bdc9b381a06193d27cf2fb7c2fb608a.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-04-29</div><div class="title">微信支付对接</div></div></a></div><div><a href="/page/SecurityCode.html" title="第三方滑动验证码接口"><img class="cover" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@3df69ce79a43aead58a4cff7b7fa87893cc5b560/2021/03/21/225a42983e955972e4038a3f1e4bf592.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-20</div><div class="title">第三方滑动验证码接口</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@6b5e7ef72be1c8973d94e5a9c49accbf775ad820/2021/02/01/c485da031fe0e464d04eaba8a66c4a8f.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">小李博客</div><div class="author-info__description">越努力，越幸运！</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">210</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">38</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">56</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xiaoliblog"><i class="fab fa-github"></i><span>博主的GitHub首页</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://gitee.com/xiaoliblog" target="_blank" title="Gitee"><i class="iconfont icon-gitee card_icon_gitee"></i></a><a class="social-icon" href="https://space.bilibili.com/390969485" target="_blank" title="BiliBili"><i class="iconfont icon-bilibili card_icon_bilibili"></i></a><a class="social-icon" href="http://wpa.qq.com/msgrd?v=3&amp;uin=2312057536&amp;site=CSDN&amp;menu=yes" target="_blank" title="QQ"><i class="iconfont icon-qq card_icon_qq"></i></a><a class="social-icon" href="https://github.com/xiaoliblog" target="_blank" title="GitHub"><i class="iconfont icon-git card_icon_git"></i></a><a class="social-icon" href="https://blog.csdn.net/qq_43266250?spm=1010.2135.3001.5113" target="_blank" title="CSDN"><i class="iconfont icon-csdn card_icon_csdn"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">正在考研备考中💦</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%B4%AD%E4%B9%B0"><span class="toc-number">1.</span> <span class="toc-text">服务器购买</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%BD%BB%E9%87%8F%E7%BA%A7%E6%9C%8D%E5%8A%A1%E5%99%A8"><span class="toc-number">1.1.</span> <span class="toc-text">轻量级服务器</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%8F%AF%E8%A7%86%E5%8C%96%E9%9D%A2%E6%9D%BF"><span class="toc-number">2.</span> <span class="toc-text">设置可视化面板</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E5%AE%9D%E5%A1%94%E9%9D%A2%E6%9D%BF"><span class="toc-number">2.1.</span> <span class="toc-text">配置宝塔面板</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E9%9D%A2%E6%9D%BF%E5%88%9D%E5%A7%8B%E5%AF%86%E7%A0%81"><span class="toc-number">2.2.</span> <span class="toc-text">获取面板初始密码</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BF%98%E8%AE%B0%E5%AE%9D%E5%A1%94%E5%AF%86%E7%A0%81%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88"><span class="toc-number">2.3.</span> <span class="toc-text">忘记宝塔密码的解决方案</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%99%BB%E5%BD%95%E9%9D%A2%E6%9D%BF"><span class="toc-number">2.4.</span> <span class="toc-text">登录面板</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#XShell%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5"><span class="toc-number">3.</span> <span class="toc-text">XShell远程连接</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#XShell"><span class="toc-number">3.1.</span> <span class="toc-text">XShell</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Xftp"><span class="toc-number">3.2.</span> <span class="toc-text">Xftp</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E5%AE%9D%E5%A1%94"><span class="toc-number">3.3.</span> <span class="toc-text">安装宝塔</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Tomcat%E9%83%A8%E7%BD%B2Java%E9%A1%B9%E7%9B%AE"><span class="toc-number">4.</span> <span class="toc-text">Tomcat部署Java项目</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5%E8%B6%85%E7%BA%A7%E7%AE%A1%E7%90%86%E5%91%98%E6%9D%83%E9%99%90"><span class="toc-number">4.1.</span> <span class="toc-text">远程连接超级管理员权限</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85JDK"><span class="toc-number">4.2.</span> <span class="toc-text">安装JDK</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85"><span class="toc-number">4.3.</span> <span class="toc-text">环境安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E7%AB%99%E7%82%B9"><span class="toc-number">4.4.</span> <span class="toc-text">配置站点</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%94%BE%E8%A1%8C%E7%AB%AF%E5%8F%A3"><span class="toc-number">4.5.</span> <span class="toc-text">放行端口</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%83%A8%E7%BD%B2%E9%A1%B9%E7%9B%AE"><span class="toc-number">4.6.</span> <span class="toc-text">部署项目</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/page/project01.html" title="前端实例🥳响应式网站首页"><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@c19917500ab083c77c7613263ba7ee74d5a08ae6/2021/04/30/469f30b141d73fa0fc4c962662d5813f.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="前端实例🥳响应式网站首页"/></a><div class="content"><a class="title" href="/page/project01.html" title="前端实例🥳响应式网站首页">前端实例🥳响应式网站首页</a><time datetime="2021-04-30T11:50:53.094Z" title="发表于 2021-04-30 19:50:53">2021-04-30</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/page/WeChatpay.html" title="微信支付对接"><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@f2f670b92ea149650ffa7834354fc90284f2f44a/2021/04/29/5bdc9b381a06193d27cf2fb7c2fb608a.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="微信支付对接"/></a><div class="content"><a class="title" href="/page/WeChatpay.html" title="微信支付对接">微信支付对接</a><time datetime="2021-04-29T12:20:48.070Z" title="发表于 2021-04-29 20:20:48">2021-04-29</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/page/Alipay.html" title="支付宝支付对接"><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@61a9b6a6e09e4bda38bb08e3104b717885beaee5/2021/04/29/c3fa51f9cf14e90d9e5a7aa8814dd041.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="支付宝支付对接"/></a><div class="content"><a class="title" href="/page/Alipay.html" title="支付宝支付对接">支付宝支付对接</a><time datetime="2021-04-27T16:00:00.000Z" title="发表于 2021-04-28 00:00:00">2021-04-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/page/Vuejs11.html" title="Vue.js前端框架🎯Pagination+PageHelper实现分页"><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@61bf4245f6d84d2d0f66d163b89c916788cc1845/2021/04/13/ec6b232f8fe5a840e4bd8c3eabcf49b2.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="Vue.js前端框架🎯Pagination+PageHelper实现分页"/></a><div class="content"><a class="title" href="/page/Vuejs11.html" title="Vue.js前端框架🎯Pagination+PageHelper实现分页">Vue.js前端框架🎯Pagination+PageHelper实现分页</a><time datetime="2021-04-26T14:48:39.701Z" title="发表于 2021-04-26 22:48:39">2021-04-26</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/page/Vuejs10.html" title="Vue.js前端框架🎯Vue-Element-admin模版"><img src="https://cdn.jsdelivr.net/gh/xiaoliblog/image@61bf4245f6d84d2d0f66d163b89c916788cc1845/2021/04/13/ec6b232f8fe5a840e4bd8c3eabcf49b2.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/lzyblog/image@main/2020/11/19/bd16b394f7359083b1f6072a67e3f968.png'" alt="Vue.js前端框架🎯Vue-Element-admin模版"/></a><div class="content"><a class="title" href="/page/Vuejs10.html" title="Vue.js前端框架🎯Vue-Element-admin模版">Vue.js前端框架🎯Vue-Element-admin模版</a><time datetime="2021-04-19T16:00:00.000Z" title="发表于 2021-04-20 00:00:00">2021-04-20</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 小李博客</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">🎯Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">🎉Butterfly</a></div><div class="footer_custom_text"><span><a style="margin-inline:5px" target="_blank" href="https://hexo.io/"><img src="https://img.shields.io/badge/Frame-Hexo-blue?style=flat&logo=hexo" title="博客框架为Hexo"></a><a style="margin-inline:5px" target="_blank" href="https://butterfly.js.org/"><img src="https://img.shields.io/badge/Theme-Butterfly-6513df?style=flat&logo=bitdefender" title="主题采用butterfly"></a><a style="margin-inline:5px" target="_blank" href="https://www.jsdelivr.com/"><img src="https://img.shields.io/badge/CDN-jsDelivr-orange?style=flat&logo=jsDelivr" title="本站使用JsDelivr为静态资源提供CDN加速"></a><a style="margin-inline:5px" target="_blank" href="https://vercel.com/ "><img src="https://img.shields.io/badge/Hosted-Vercel-brightgreen?style=flat&logo=Vercel" title="本站采用双线部署，默认线路托管于Vercel"></a><a style="margin-inline:5px" target="_blank" href="https://coding.net/ "><img src="https://img.shields.io/badge/Hosted-Coding-0cedbe?style=flat&logo=Codio" title="本站采用双线部署，联通线路托管于Coding"></a><a style="margin-inline:5px" target="_blank" href="https://github.com/"><img src="https://img.shields.io/badge/Source-Github-d021d6?style=flat&logo=GitHub" title="本站项目由Gtihub托管"></a><a style="margin-inline:5px" target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&logo=Claris" title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"></a></span></div><div class="icp"><a target="_blank" rel="noopener" href="https://beian.miit.gov.cn/"><img class="icp-icon" src="/img/icp.png" alt="ICP"/><span>湘ICP备2021002541号</span></a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="font-plus" type="button" title="放大字体"><i class="fas fa-plus"></i></button><button id="font-minus" type="button" title="缩小字体"><i class="fas fa-minus"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="chat_btn" type="button" title="rightside.chat_btn"><i class="fas fa-sms"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="algolia-search"><div class="search-dialog"><div class="search-dialog__title" id="algolia-search-title">Algolia</div><div id="algolia-input-panel"><div id="algolia-search-input"></div></div><hr/><div id="algolia-search-results"><div id="algolia-hits"></div><div id="algolia-pagination"></div><div id="algolia-stats"></div></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script><script src="/js/main.js"></script><script defer src="/js/tw_cn.js"></script><script defer src="https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module" defer></script><script defer src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script defer src="/js/search/algolia.js"></script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    loader: {
      source: {
        '[tex]/amsCd': '[tex]/amscd'
      }
    },
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        addClass: [200,() => {
          document.querySelectorAll('mjx-container:not([display=\'true\']').forEach( node => {
            const target = node.parentNode
            if (!target.classList.contains('has-jax')) {
              target.classList.add('mathjax-overflow')
            }
          })
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typeset()
}</script><script>if (document.getElementsByClassName('mermaid').length) {
  if (window.mermaidJsLoad) mermaid.init()
  else {
    getScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js').then(() => {
      window.mermaidJsLoad = true
      mermaid.initialize({
        theme: 'default',
      })
      false && mermaid.init()
    })
  }
}</script><script>(()=>{
  const $countDom = document.getElementById('twikoo-count')
  const init = () => {
    twikoo.init(Object.assign({
      el: '#twikoo-wrap',
      envId: 'xiaoliblog-8gj3j5045d5b0896',
      region: ''
    }, null))
  }

  const getCount = () => {
    twikoo.getCommentsCount({
      envId: 'xiaoliblog-8gj3j5045d5b0896',
      region: '',
      urls: [window.location.pathname],
      includeReply: false
    }).then(function (res) {
      $countDom.innerText = res[0].count
    }).catch(function (err) {
      console.error(err);
    });
  }

  const loadTwikoo = (bool = false) => {
    if (typeof twikoo === 'object') {
      init()
      bool && $countDom && setTimeout(getCount,0)
    } else {
      getScript('https://cdn.jsdelivr.net/npm/twikoo@1.3.0/dist/twikoo.all.min.js').then(()=> {
        init()
        bool && $countDom && setTimeout(getCount,0)
      })
    }
  }

  if ('Twikoo' === 'Twikoo' || !true) {
    if (true) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
    else loadTwikoo(true)
  } else {
    window.loadOtherComment = () => {
      loadTwikoo()
    }
  }
})()</script></div><script defer src="//lib.baomitu.com/jquery/3.5.1/jquery.min.js"></script><script defer src="https://myhkw.cn/api/player/160561664166" id="myhk" key="160561664166" m="1"></script><div><canvas id="snow" style="position:fixed;top:0;left:0;width:100%;height:100%;z-index:99999;pointer-events:none"></canvas></div><script>const notMobile = (!(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)));</script><scrip async type="text/javascript" src="https://cdn.jsdelivr.net/gh/Candinya/Kratos-Rebirth@latest/source/js/snow.min.js"></scrip><scrip defer src="https://cdn.jsdelivr.net/npm/hexo-theme-volantis@latest/source/js/issues.min.js"></scrip><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><script>var gitcalendar = new Vue({
  el: '#gitcalendar',
  data: {
    simplemode: true, 
    user: 'xiaoliblog',
    fixed: 'fixed',
    px: 'px',
    x: '',
    y: '',
    span1: '',
    span2: '',
    month: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
    monthchange: [],
    oneyearbeforeday: '',
    thisday: '',
    amonthago: '',
    aweekago: '',
    weekdatacore: 0,
    datacore: 0,
    total: 0,
    datadate: '',
    data: [],
    positionplusdata: [],
    firstweek: [],
    lastweek: [],
    beforeweek: [],
    thisweekdatacore: 0,
    mounthbeforeday: 0,
    mounthfirstindex: 0,
    crispedges: 'crispedges',
    thisdayindex: 0,
    amonthagoindex: 0,
    amonthagoweek: [],
    firstdate: [],
    first2date: [],
    montharrbefore: [],
    monthindex: 0,
    color: ['#ebedf0', '#f1f8ff', '#dbedff', '#c8e1ff', '#79b8ff', '#2188ff', '#0366d6', '#005cc5', '#044289', '#032f62', '#05264c']
  },
  methods: {
    selectStyle(data, event) {
      document.querySelector('.angle-wrapper').style.display = 'block'
      this.span1 = data.date;
      this.span2 = data.count;
      this.x = event.clientX - 100;
      this.y = event.clientY - 60
    },
    outStyle() {
      document.querySelector('.angle-wrapper').style.display = 'none'
    },
    thiscolor(x) {
      if (x === 0) {
        let i = parseInt(x / 2);
        return this.color[0]
      } else if (x < 2) {
        return this.color[1]
      } else if (x < 20) {
        let i = parseInt(x / 2);
        return this.color[i]
      } else {
        return this.color[9]
      }
    },
  }
});
var apiurl = 'python-github-calendar-api-ruby.vercel.app' ? 'https://python-github-calendar-api-ruby.vercel.app/api?' : 'https://githubapi.ryanchristian.dev/user/'
var githubapiurl = apiurl + gitcalendar.user;
//canvas绘图
function responsiveChart() {
  let c = document.getElementById("gitcanvas");
  if (c) {
    let cmessage = document.getElementById("gitmessage");
    let ctx = c.getContext("2d");
    c.width = document.getElementById("gitcalendarcanvasbox").offsetWidth;
    let linemaxwitdh = 0.96 * c.width / gitcalendar.data.length;
    c.height = 9 * linemaxwitdh;
    let lineminwitdh = 0.8 * linemaxwitdh;
    let setposition = {
      x: 0.02 * c.width,
      y: 0.025 * c.width
    };
    for (let week in gitcalendar.data) {
      weekdata = gitcalendar.data[week];
      for (let day in weekdata) {
        let dataitem = {
          date: "",
          count: "",
          x: 0,
          y: 0
        };
        gitcalendar.positionplusdata.push(dataitem);
        ctx.fillStyle = gitcalendar.thiscolor(weekdata[day].count);
        setposition.y = Math.round(setposition.y * 100) / 100;
        dataitem.date = weekdata[day].date;
        dataitem.count = weekdata[day].count;
        dataitem.x = setposition.x;
        dataitem.y = setposition.y;
        ctx.fillRect(setposition.x, setposition.y, lineminwitdh, lineminwitdh);
        setposition.y = setposition.y + linemaxwitdh
      };
      setposition.y = 0.025 * c.width;
      setposition.x = setposition.x + linemaxwitdh
    };
    ctx.font = "600  Arial";
    ctx.fillStyle = '#aaa';
    ctx.fillText("日", 0, 1.9 * linemaxwitdh);
    ctx.fillText("二", 0, 3.9 * linemaxwitdh);
    ctx.fillText("四", 0, 5.9 * linemaxwitdh);
    ctx.fillText("六", 0, 7.9 * linemaxwitdh);
    let monthindexlist = c.width / 24;
    for (let index in gitcalendar.monthchange) {
      ctx.fillText(gitcalendar.monthchange[index], monthindexlist, 0.7 * linemaxwitdh);
      monthindexlist = monthindexlist + c.width / 12
    };
    cmessage.onmousemove = function(event) {
      document.querySelector('.angle-wrapper').style.display = 'none'
    };
    c.onmousemove = function(event) {
      document.querySelector('.angle-wrapper').style.display = 'none'
      getMousePos(c, event);
    };

    function getMousePos(canvas, event) {
      var rect = canvas.getBoundingClientRect();
      var x = event.clientX - rect.left * (canvas.width / rect.width);
      var y = event.clientY - rect.top * (canvas.height / rect.height);
      //console.log("x:"+x+",y:"+y);
      for (let item of gitcalendar.positionplusdata) {
        let lenthx = x - item.x;
        let lenthy = y - item.y;
        //console.log(lenthx,lenthy);
        if (0 < lenthx && lenthx < lineminwitdh) {
          if (0 < lenthy && lenthy < lineminwitdh) {
            //console.log(item.date,item.count)
            document.querySelector('.angle-wrapper').style.display = 'block'
            gitcalendar.span1 = item.date;
            gitcalendar.span2 = item.count;
            gitcalendar.x = event.clientX - 100;
            gitcalendar.y = event.clientY - 60
          }
        }
        //if(0< x - item.x <lineminwitdh&&0< y - item.y <lineminwitdh){
        //console.log(item.count,item.date);
        //}
      }
    }
  }
}
//数据统计算法
function addlastmonth() {
  if (gitcalendar.thisdayindex === 0) {
    thisweekcore(52);
    thisweekcore(51);
    thisweekcore(50);
    thisweekcore(49);
    thisweekcore(48);
    gitcalendar.thisweekdatacore += gitcalendar.firstdate[6].count;
    gitcalendar.amonthago = gitcalendar.firstdate[6].date
  } else {
    thisweekcore(52);
    thisweekcore(51);
    thisweekcore(50);
    thisweekcore(49);
    thisweek2core();
    gitcalendar.amonthago = gitcalendar.first2date[gitcalendar.thisdayindex - 1].date
  }
};

function thisweek2core() {
  for (let i = gitcalendar.thisdayindex - 1; i < gitcalendar.first2date.length; i++) {
    gitcalendar.thisweekdatacore += gitcalendar.first2date[i].count
  }
};

function thisweekcore(index) {
  for (let item of gitcalendar.data[index]) {
    gitcalendar.thisweekdatacore += item.count
  }
};

function addlastweek() {
  for (let item of gitcalendar.lastweek) {
    gitcalendar.weekdatacore += item.count
  }
};

function addbeforeweek() {
  for (let i = gitcalendar.thisdayindex; i < gitcalendar.beforeweek.length; i++) {
    gitcalendar.weekdatacore += gitcalendar.beforeweek[i].count
  }
};

function addweek(data) {
  if (gitcalendar.thisdayindex === 6) {
    gitcalendar.aweekago = gitcalendar.lastweek[0].date;
    addlastweek()
  } else {
    lastweek = data.contributions[51];
    gitcalendar.aweekago = lastweek[gitcalendar.thisdayindex + 1].date;
    addlastweek();
    addbeforeweek()
  }
}

fetch(githubapiurl)
  .then(data => data.json())
  .then(data => {
    gitcalendar.data = data.contributions;
    gitcalendar.total = data.total;
    gitcalendar.first2date = gitcalendar.data[48];
    gitcalendar.firstdate = gitcalendar.data[47];
    gitcalendar.firstweek = data.contributions[0];
    gitcalendar.lastweek = data.contributions[52];
    gitcalendar.beforeweek = data.contributions[51];
    gitcalendar.thisdayindex = gitcalendar.lastweek.length - 1;
    gitcalendar.thisday = gitcalendar.lastweek[gitcalendar.thisdayindex].date;
    gitcalendar.oneyearbeforeday = gitcalendar.firstweek[0].date;
    gitcalendar.monthindex = gitcalendar.thisday.substring(5, 7) * 1;
    gitcalendar.montharrbefore = gitcalendar.month.splice(gitcalendar.monthindex, 12 - gitcalendar.monthindex);
    gitcalendar.monthchange = gitcalendar.montharrbefore.concat(gitcalendar.month);
    addweek(data);
    addlastmonth();
    responsiveChart();
  })
  .catch(function(error) {
    console.log(error);
  });

//手机版更换为svg绘制
if (document.getElementById("gitcalendarcanvasbox").offsetWidth < 500) {
  gitcalendar.simplemode = false
}

//当改变窗口大小时重新绘制canvas
window.onresize = function() {
  if (gitcalendar.simplemode) responsiveChart()
}

//解决滚动滑轮时出现的标签显示
window.onscroll = function() {
  if (document.querySelector('.angle-wrapper')) {
    document.querySelector('.angle-wrapper').style.display = 'none'
  }
};</script></div><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"log":false,"model":{"jsonPath":"/live2dw/assets/hijiki.model.json"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":true},"react":{"opacity":0.7}});</script></body></html>